#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution{
    public:
    int ans1(vector<int>& nums){
        int len = nums.size();
        sort(nums.begin(), nums.end());
        int ret = 0;
        if(len == 1){
            return nums[0];
        }
        for(int i = 1; i != len-1; i++){
            if(nums[i-1] != nums[i] && nums[i] != nums[i+1]){
                ret = nums[i];
            }
            if(nums[i-1] != nums[i] && i == 1){
                ret = nums[i-1];
            }
            if(nums[i] != nums[i+1] && i == len-2){
                ret = nums[i+1];
            }
        }

        return ret;
    }
};

void test1(){
    Solution s;
    vector<int> nums = {2,2,3,2};

    int ret = s.ans1(nums);
    cout << ret << endl;
}

void test2(){
    Solution s;
    vector<int> nums = {0,1,0,1,0,1,99};

    int ret = s.ans1(nums);
    cout << ret << endl;
}


int main(void){
    test1();
    test2();

    return 0;
}